package com.david.interview.step1;

/**
 * @author David
 * @version V1.0
 * @Package com.david.interview.step1
 * @date 2021/7/2 15:05
 */
public class P05 {
    public static void main(String[] args) {
        System.out.println(f(1));
        System.out.println(f(2));
        System.out.println(f(3));
        System.out.println(f(4));
    }
    private static int f(int n){
        if (n<1){
            throw new IllegalArgumentException("n不能小于1！");
        }
        if (n==1|| n==2) {
            return n;
        }
        return f(n-2)+f(n-1);
    }
}
